#pragma once
#include <stdlib.h>
#include <stdio.h>
#include "Vector3.h"
#include "Box.h"
#include "Plane.h"
#ifdef WIN32
#include <GL/glut.h>
#endif
#ifdef __APPLE__
#include <GLUT/glut.h>
#endif

namespace lib3dw
{
	enum 
	{
		TOP = 0,
		BOTTOM,
		LEFT,
		RIGHT,
		NEARP,
		FARP
	};
	enum
	{
		OUTSIDE,
		INTERSECT,
		INSIDE
	};
	
	class Frustum 
	{
		private:
			Plane pl[6];
			Vector3 ntl,ntr,nbl,nbr,ftl,ftr,fbl,fbr;
			float nearD;
			float farD;
			float ratio;
			float angle;
			float tang;
			float nw;
			float nh;
			float fw;
			float fh;

		public:
			Frustum();
			~Frustum();

			void SetViewport(float newAngle, float newRatio, float newNearD, float newFarD);
			void SetCamera(Vector3 &p, Vector3 &l, Vector3 &u);
			int Test(Box* b);
	};
}